package demo2;

class Message<T> {
    private T message ;

    public T getMessage() {
        return message;
    }

    public void setMessage(T message) {
        this.message = message;
    }
}

public class Test {

    public static void fun(Message<?> temp){
        //temp.setMessage("cold"); // 不能往里面加元素
        System.out.println(temp.getMessage());
    }

    public static void main(String[] args) {
        Message<String> message1 = new Message() ;
        message1.setMessage("frost");
        fun(message1);

        Message<Integer> message2 = new Message() ;
        message2.setMessage(1);
        fun(message2);
    }
}
